package com.econ.powercloud.ems.service.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.econ.powercloud.ems.dal.entity.EmsFeeConfirmExplain;
import com.econ.powercloud.ems.dal.mapper.EmsFeeConfirmExplainMapper;
import org.springframework.stereotype.Repository;

/**
 * @Author : zjf
 * @Description : EmsFeeConfirmExplain DAO层
 * @Date : 2022/4/24 16:05
 * @Modified by : zjf
 */
@Repository
public class EmsFeeConfirmExplainDAO extends ServiceImpl<EmsFeeConfirmExplainMapper, EmsFeeConfirmExplain> {

    public EmsFeeConfirmExplain selectByProvinceAndCity(Integer province, Integer city){
        LambdaQueryWrapper<EmsFeeConfirmExplain> lambdaQueryWrapper = Wrappers.lambdaQuery();
        lambdaQueryWrapper.eq(EmsFeeConfirmExplain::getProvince, province);
        lambdaQueryWrapper.apply( "FIND_IN_SET ('" + city + "',city)");
        lambdaQueryWrapper.last("limit 1");
        return this.baseMapper.selectOne(lambdaQueryWrapper);
    }
}
